var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var ResKeeper = require("AA_ResKeeper");
var NodePoolMag = require("AA_NodePoolMag");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
_decorator.property;

var _def_UI_BaoZha = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.baozaAni = null;
    t.bingbaoAni = null;
    t.yintaobaozha = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {};
  _creator.prototype.playBaoZa = function (e) {
    undefined === e && (e = 100);
    e < 100 && (e = 100);
    this.node.scale = 1 + e / 100;
    this.node.children.forEach(function (e) {
      e.active = false;
    });
    this.baozaAni = this.node.children[0].getComponent(dragonBones.ArmatureDisplay);
    this.baozaAni.node.active = true;
    this.baozaAni.playAnimation("newAnimation", 1);
    this.baozaAni.addEventListener(dragonBones.EventObject.LOOP_COMPLETE, this.onAniState, this);
  };
  _creator.prototype.playBingBao = function () {
    this.node.scale = 3;
    this.node.children.forEach(function (e) {
      e.active = false;
    });
    this.bingbaoAni = this.node.children[1].getComponent(dragonBones.ArmatureDisplay);
    this.bingbaoAni.node.active = true;
    this.bingbaoAni.playAnimation("bingbao", 1);
    this.bingbaoAni.timeScale = 1.5;
    this.bingbaoAni.addEventListener(dragonBones.EventObject.LOOP_COMPLETE, this.onAniState, this);
  };
  _creator.prototype.playYinTaoBaoZha = function (e) {
    undefined === e && (e = 100);
    e < 100 && (e = 100);
    this.node.scale = 1 + e / 100 * .5;
    this.node.children.forEach(function (e) {
      e.active = false;
    });
    this.yintaobaozha = this.node.children[2].getComponent(cc.Animation);
    this.yintaobaozha.node.active = true;
    this.yintaobaozha.play();
    this.scheduleOnce(this.onAniState, 1);
  };
  _creator.prototype.onAniState = function () {
    NodePoolMag.NodePoolMag.instance.recycleNode("baozha", this.node);
  };
  _creator.prototype.onDisable = function () {
    this.baozaAni && this.baozaAni.node.active && this.baozaAni.removeEventListener(dragonBones.EventObject.LOOP_COMPLETE, this.onAniState, this);
    this.bingbaoAni && this.bingbaoAni.node.active && this.bingbaoAni.removeEventListener(dragonBones.EventObject.LOOP_COMPLETE, this.onAniState, this);
  };
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_BaoZha;